<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});
Route::prefix('welink')->group( function () {
    Route::post('login', [\App\Http\Controllers\Api\WeLinkController::class, 'login']);
    Route::post('getSubscribe', [\App\Http\Controllers\Api\WeLinkController::class, 'getSubscribe']);
});

Route::get('login', [\App\Http\Controllers\Api\PublicController::class, 'login'])->name('login');
Route::get('register', [\App\Http\Controllers\Api\PublicController::class, 'register'])->name('register');
Route::prefix('index')->group( function () {
    Route::get('test', [\App\Http\Controllers\Api\IndexController::class, 'test']);
    Route::get('index', [\App\Http\Controllers\Api\IndexController::class, 'index'])->name('index');
    Route::post('lastFiveYears', [\App\Http\Controllers\Api\IndexController::class, 'lastFiveYears']);
    Route::post('birthAndDeath', [\App\Http\Controllers\Api\IndexController::class, 'birthAndDeath']);
    Route::post('residentPopulation', [\App\Http\Controllers\Api\IndexController::class, 'residentPopulation']);
    Route::post('eventSource', [\App\Http\Controllers\Api\IndexController::class, 'eventSource']);
});
